package ge.telasi.tasks.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author dimitri
 */
@Entity
@Table(name = "task_receiver_indecies")
public class TaskReceiverIndex implements Serializable {
    private static final long serialVersionUID = 2096993761888656946L;

    @Id
    @Column(name = "id")
    private Long id;
    @ManyToOne
    @JoinColumn(name = "user_id")
    private User user;
    @ManyToOne
    @JoinColumn(name = "task_id")
    private Task task;
    @Column(name = "is_new")
    private int newBit;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Task getTask() {
        return task;
    }

    public void setTask(Task task) {
        this.task = task;
    }

    public boolean isNew() {
        return newBit == 1;
    }

    public void setNew(boolean isNew) {
        this.newBit = isNew ? 1 : 0;
    }

}
